package com.saturday.common.exception;

import lombok.Data;

import java.io.Serializable;

/**
 * 业务异常
 */
@Data
public class BusinessException extends RuntimeException implements Serializable {

    public static final String FAIL_CODE = "100";

    private String code;

    private String message;

    public BusinessException(String message) {
        super(message);
        this.code = FAIL_CODE;
        this.message = message;
    }

    public BusinessException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public static BusinessException createException(String message) {
        return new BusinessException(message);
    }

    public static BusinessException createException(String code, String message) {
        return new BusinessException(code, message);
    }
}
